home *** CD-ROM | disk | FTP | other *** search
- ;void char_line(ch,dir,col,row,length,color);
- ; unsigned char ch,dir,col,row,length,color;
-
-
- EXTRN _memory_model:byte
- EXTRN _video_buffer:word
- EXTRN _snow_protect:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _char_line
- _char_line proc near
- push bp ;
- mov bp,sp ;set stack frame
- push di ;
- push si ;
- cmp _memory_model,0 ;near or far?
- jle begin ;jump if near
- inc bp ;else add 2 to BP
- inc bp ;
- begin: cld ;set direction flag
- mov ax,_video_buffer ;fetch _video_buffer
- mov es,ax ;shift to ES
- sub ax,ax ;
- mov al,[bp+10] ;get ROW value
- dec ax ;count from 0
- cmp ax,24 ;is the row in range?
- ja L5 ;quit if not
- mov dl,160 ;160 bytes per line
- mul dl ;times number rows
- sub bx,bx ;
- mov bl,[bp+8] ;get COL value
- mov di,bx ;
- dec di ;count from 0
- cmp di,79 ;is the col in range?
- ja L5 ;quit if not
- shl di,1 ;double for attri bytes
- add di,ax ;now ES:DI pts to 1st pos
- sub cx,cx ;
- mov cl,[bp+12] ;string length in CX
- jcxz L5 ;quit if zero
- mov ah,[bp+14] ;attribute in AH
- mov al,[bp+4] ;char in AL
- mov bl,[bp+6] ;get direction param
- mov si,158 ;SI added to scrn ptr
- cmp bl,'V' ;write vertically?
- je L1 ;jump ahead if so
- cmp bl,'v' ;test small 'v' also
- je L1 ;jump if small 'v'
- sub si,si ;add 0 to ptr if horzntl
- L1: cmp _snow_protect,0 ;protect against snow?
- je L4 ;jump ahead if not
- mov dx,3dah ;status byte address
- mov bx,ax ;save AX contents
- L2: in al,dx ;get status byte
- test al,1 ;test bit
- jnz L2 ;loop till 0
- cli ;disable interrupts
- L3: in al,dx ;get status byte
- test al,1 ;test bit
- jz L3 ;loop till 1
- mov ax,bx ;restore AX contents
- L4: stosw ;write char
- add di,si ;add offset to ptr
- loop L1 ;go write next
- L5: sti ;reenable interrupts
- pop si ;
- pop di ;
- pop bp ;
- cmp _memory_model,0 ;quit
- jle quit ;
- db 0CBh ;RET far
- quit: ret ;RET near
- _char_line endp
- _TEXT ENDS
- END